#include<iostream>
#include<cstdio>
using namespace std;
int y,m,d,h,u,v,s;
int t[10];
char c[1000];
void read(){
    scanf("%s",c+1);
    int i;
    i=1;
    while(c[i]==' '){
        i++;
    }
    if(c[i]=='Z'){
        y=1;
    }
    if(c[i]=='C'&&c[i+3]=='u'){
        y=2;
    }
    if(c[i]=='Y'&&c[i+1]=='i'){
        y=3;
    }
    if(c[i]=='M'){
        y=4;
    }
    if(c[i]=='C'&&c[i+3]=='n'){
        y=5;
    }
    if(c[i]=='S'&&c[i+1]=='i'){
        y=6;
    }
    if(c[i]=='W'&&c[i+1]=='u'){
        y=7;
    }
    if(c[i]=='W'&&c[i+1]=='e'){
        y=8;
    }
    if(c[i]=='S'&&c[i+1]=='h'){
        y=9;
    }
    if(c[i]=='Y'&&c[i+1]=='o'){
        y=10;
    }
    if(c[i]=='X'){
        y=11;
    }
    if(c[i]=='H'){
        y=12;
    }
    scanf("%d%d",&m,&d);
    scanf("%s",c+1);
    i=1;
    while(c[i]==' '){
        i++;
    }
    if(c[i]=='Z'){
        h=1;
    }
    if(c[i]=='C'&&c[i+3]=='u'){
        h=2;
    }
    if(c[i]=='Y'&&c[i+1]=='i'){
        h=3;
    }
    if(c[i]=='M'){
        h=4;
    }
    if(c[i]=='C'&&c[i+4]=='n'){
        h=5;
    }
    if(c[i]=='S'&&c[i+1]=='i'){
        h=6;
    }
    if(c[i]=='W'&&c[i+1]=='u'){
        h=7;
    }
    if(c[i]=='W'&&c[i+1]=='e'){
        h=8;
    }
    if(c[i]=='S'&&c[i+1]=='h'){
        h=9;
    }
    if(c[i]=='Y'&&c[i+1]=='o'){
        h=10;
    }
    if(c[i]=='X'){
        h=11;
    }
    if(c[i]=='H'){
        h=12;
    }
}
int main(){
    read();
//    printf("%d %d %d %d\n",y,m,d,h);
    u=(y+m+d+7)%8;
    v=(y+m+d+h+7)%8;
    s=(y+m+d+h+5)%6+1;
    s=(6-s)%6+1;
    t[1]=u%2;u/=2;
    t[2]=u%2;u/=2;
    t[3]=u%2;u/=2;
    t[4]=v%2;v/=2;
    t[5]=v%2;v/=2;
    t[6]=v%2;v/=2;
    for(int i=1;i<=6;i++){
        if(t[i]==0){
            puts("---");
        }
        else{
            puts("- -");
        }
    }
    puts("");
    t[s]=t[s]^1;
    for(int i=1;i<=6;i++){
        if(t[i]==0){
            puts("---");
        }
        else{
            puts("- -");
        }
    }
    return 0;
}